package com.house.service.impl;

import com.house.common.PageResult;
import com.house.entity.House;
import com.house.service.HouseService;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;

@Service
public class HouseServiceImpl implements HouseService {

    @Override
    public PageResult<House> getHouseList(Integer page, Integer size, String area, String type,
                                        Integer priceMin, Integer priceMax, Integer status,
                                        String sortField, String sortOrder) {
        // Mock数据
        List<House> mockHouses = new ArrayList<>();
        mockHouses.add(House.builder()
                .id("1")
                .title("东湖高新区精装单间")
                .address("武汉市东湖高新区光谷大道")
                .area(50.5)
                .type("1室1厅")
                .price(2000)
                .status(0)
                .images(Arrays.asList("url1", "url2"))
                .features(Arrays.asList("电梯", "独卫"))
                .createTime(new Date())
                .build());

        mockHouses.add(House.builder()
                .id("2")
                .title("江汉区豪华两房")
                .address("武汉市江汉区解放大道")
                .area(88.0)
                .type("2室1厅")
                .price(3500)
                .status(0)
                .images(Arrays.asList("url3", "url4"))
                .features(Arrays.asList("电梯", "独卫", "阳台"))
                .createTime(new Date())
                .build());

         mockHouses.add(House.builder()
                .id("3")
                .title("江汉两房")
                .address("武汉市江汉区解放大道")
                .area(88.0)
                .type("2室1厅")
                .price(3500)
                .status(0)
                .images(Arrays.asList("url3", "url4"))
                .features(Arrays.asList("电梯", "独卫", "阳台"))
                .createTime(new Date())
                .build());

        return new PageResult<>(2L, mockHouses);
    }
} 